<%@ page import="java.util.List" %>
<%@ page import="com.foreknow.bean.Guestbook" %><%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2021/12/1
  Time: 10:44
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <title>Title</title>
    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css">

</head>
<body>
    <div class="container">
        <h2>用户名:${sessionScope.users.adminname}</h2>
        <table class="table table-hover">
            <tr>
                <th>id</th>
                <th>name</th>
                <th>phone</th>
                <th>email</th>
                <th>title</th>
                <th>content</th>
                <th>createdtime</th>
                <th>操作</th>
            </tr>
<%--            <%--%>
<%--                //java代码--%>
<%--//        从request中获取list集合,然后遍历集合--%>
<%--                List<Object> list = (List<Object>)request.getAttribute("list");--%>
<%--                for (int i = 0;i<list.size();i++){--%>
<%--                    Guestbook guestbook = (Guestbook) list.get(i);--%>
<%--                    %>--%>
<%--       items接收一个集合list或者requestScope.list   var表示变量的名称    varStatus 属性 index: 当前这次迭代从 0 开始的迭代索引--%>
            <c:forEach var="gb" items="${sessionScope.list}" varStatus="status">
                            <tr>
                                <td>${status.index+1}</td>
                                <td>${gb.name}</td>
                                <td>${gb.phone}</td>
                                <td>${gb.email}</td>
                                <td>${gb.title}</td>
                                <td>${gb.content}</td>
                                <td>${gb.createdtime}</td>
                                <td>
                                    <a href="/WebTest_01/m?q=jump" class="btn btn-primary">添加</a>
                                    <a href="/WebTest_01/m?q=jumpp&id=${gb.id}" class="btn btn-warning">修改</a>
                                    <a href="/WebTest_01/m?q=delete&id=${gb.id}" class="btn btn-danger">删除</a>
                                </td>
                            </tr>
            </c:forEach>

<%--            <%--%>
<%--                }--%>
<%--            %>--%>
        </table>
    </div>
<script>



</script>
</body>
</html>
